package robot;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.text.SimpleDateFormat;
import java.util.Date;

public class InfinityTest {
	public static void main(String[] args) throws AWTException {
		int ss = 3;		//间隔秒数  建议别小于三秒  不然不容易暂停
		int cc = 3000;	//间隔期间点赞次数  建议少于50  容易卡  甚至点赞无效
		int mm = 10;	//点赞持续分钟数
		int x = 1072;	//鼠标坐标横轴   
		int y = 797;	//鼠标坐标纵轴     
		input(ss,cc,mm,x,y);
	}

	private static void input(int a,int b ,int c,int x,int y) throws AWTException {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		int count = 0;
		while (count < c * 60) {
			try {
				Thread.sleep(a * 1000);
				count++;
				System.out.print(sdf.format(new Date()) );
				try {
					clear(count,b,x,y);
				} catch (AWTException e) {
					e.printStackTrace();
				}
			} catch (InterruptedException e) {
				e.printStackTrace();
			}

		}
	}

	private static void clear(int a,int b,int x, int y) throws AWTException {
		// TODO Auto-generated method stub
		Robot r = new Robot();
		int i = 0;
		while (i < b) {
			r.mouseMove(x, y);
			r.mousePress(InputEvent.BUTTON1_MASK);
			r.mouseRelease(InputEvent.BUTTON1_MASK);
			System.out.println("循环执行第" + a + "次   第"+(i++)+"次点赞");
		}
	}
}